home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / SHOWHELP.PAS < prev    next >
Pascal/Delphi Source File  |  1988-07-24  |  3KB  |  96 lines

  1. {->>>>ShowHelp<<<<---------------------------------------------}
  2. {                                                              }
  3. { Filename : SHOWHELP.SRC -- Last Modified 7/14/88             }
  4. {                                                              }
  5. { This is a simple, single-screen help system that will save   }
  6. { the underlying screen, show a single screen's worth of help  }
  7. { information, and then restore the underlying screen once any }
  8. { key is pressed.  You must customize the ShowHelpData routine }
  9. { with your own help information; the data shown here is for   }
  10. { the JTERM terminal program from Section 23.7.                }
  11. {                                                              }
  12. {     From: COMPLETE TURBO PASCAL 5.0  by Jeff Duntemann       }
  13. {    Scott, Foresman & Co., Inc. 1988   ISBN 0-673-38355-5     }
  14. {--------------------------------------------------------------}
  15.  
  16. PROCEDURE ShowHelp;    { Shows a help screen display on press of F1 }
  17.  
  18. CONST
  19.   ScreenX = 80;
  20.   ScreenY = 25;   { This could be 43 for the EGA; 50 for VGA; 66 for Genius }
  21.  
  22. VAR
  23.   XSave,YSave : Integer;
  24.   VidSegment : Word;
  25.   VideoBufferSize : Word;
  26.   SavePtr  : ^Word;
  27.   VideoPtr : ^Word;
  28.   VideoSeg : Word;
  29.   Dummy    : Char;
  30.  
  31.  
  32. FUNCTION Monochrome : Boolean;
  33.  
  34. VAR
  35.   Regs : Registers;
  36.  
  37. BEGIN
  38.   INTR(17,Regs);
  39.   IF (Regs.AX AND $0030) = $30 THEN Monochrome := True
  40.     ELSE Monochrome := False
  41. END;
  42.  
  43.  
  44. PROCEDURE SaveScreenOut;
  45.  
  46. BEGIN
  47.   XSave := WhereX; YSave := WhereY;       { Save the underlying cursor pos. }
  48.   VideoBufferSize := ScreenX*ScreenY*2;   { E.g., 25 X 80 X 2 = 4000 bytes  }
  49.   { Allocate memory for stored screen: }
  50.   GetMem(SavePtr,VideoBufferSize);
  51.   IF Monochrome THEN VidSegment := $B000 ELSE  { Get a screen buffer origin }
  52.     VidSegment := $B800;
  53.   VideoPtr := Ptr(VidSegment,0);          { Create a pointer to the buffer  }
  54.   Move(VideoPtr^,SavePtr^,VideoBufferSize);  { Save screen out to the heap  }
  55. END;
  56.  
  57.  
  58. PROCEDURE ShowHelpData;
  59.  
  60. BEGIN
  61.   GotoXY(30,3); Writeln('>>>JTERM<<<');
  62.   Write('          From COMPLETE TURBO PASCAL 5.0, by Jeff Duntemann');
  63.   GotoXY(1,7);
  64.   Writeln('The default communications parameters are 1200, 8, N, 1');
  65.   Writeln('You can use JTERM at 300 baud by invoking it this way:');
  66.   Writeln;
  67.   Writeln('  C:\>JTERM 300');
  68.   Writeln;
  69.   Writeln('Currently active commands are:');
  70.   Writeln;
  71.   Writeln('  F1:     Displays this help screen');
  72.   Writeln('  Ctrl-Z: Clears the screen');
  73.   Writeln('  Ctrl-X: Hangs up and exits JTERM');
  74. END;
  75.  
  76.  
  77. PROCEDURE BringScreenBack;
  78.  
  79. BEGIN
  80.   Move(SavePtr^,VideoPtr^,VideoBufferSize);  { Bring screen back from heap  }
  81.   FreeMem(SavePtr,VideoBufferSize);          { Free up the meap memory      }
  82.   GotoXY(XSave,YSave);                   { Put the cursor back where it was }
  83. END;
  84.  
  85.  
  86. BEGIN  { ShowHelp }
  87.   SaveScreenOut;
  88.   ClrScr;
  89.   ShowHelpData;
  90.   GotoXY(20,23); Write('Press any key to continue...');
  91.   REPEAT UNTIL KeyPressed;
  92.   Dummy := ReadKey;
  93.   IF Dummy = Chr(0) THEN Dummy := ReadKey;
  94.   BringScreenBack;
  95. END;
  96.